package com.itheima.work01;

import java.util.concurrent.CountDownLatch;

public class Work06 {
    public static void main(String[] args) {
        CountDownLatch cdl = new CountDownLatch(3);

        new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName()+"吃水饺"+i+"个");
            }
            cdl.countDown();

        },"迪丽热巴").start();

        new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName()+"吃水饺"+i+"个");
            }cdl.countDown();
        },"迪丽热巴").start();

        new Thread(()->{
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName()+"吃水饺"+i+"个");
            }cdl.countDown();
        },"迪丽热巴").start();

        new Thread(()->{
            try {
                cdl.await();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("杨幂在收拾碗筷");
        }).start();
    }
}
